package com.zbkj.crmeb.enums;

import java.util.Objects;

import com.baomidou.mybatisplus.core.enums.IEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * 审核状态：0全部 1待审核 2审核未通过 9审核通过
 */
public enum WineryAuditStatusEnum implements IEnum<Integer> {

	/**
	 * 0全部
	 */
    ALL(0, "0全部"),

	/**
	 * 待审核
	 */
    WAIT(1, "待审核"),

	/**
	 * 审核未通过
	 */
    REJECT(2, "审核未通过"),

    /**
     * 审核通过
     */
    APPROVE(9, "审核通过"),

    ;

    private final Integer code;
    private final String msg;

    WineryAuditStatusEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    @JsonCreator
    public static WineryAuditStatusEnum valueOf(Integer code) {
        for (WineryAuditStatusEnum value : values()) {
            if (code.equals(value.getCode())) {
                return value;
            }
        }
        return ALL;
    }

    @Override
    @JsonValue
    public Integer getValue() {
        return code;
    }

    public static WineryAuditStatusEnum getEnumByCode(Integer code) {
        for (WineryAuditStatusEnum value : values()) {
            if (Objects.equals(value.getCode(), code)) {
                return value;
            }
        }
        return ALL;
    }

    public static String getMsgByCode(Integer code) {
        for (WineryAuditStatusEnum value : values()) {
            if (Objects.equals(value.getCode(), code)) {
                return value.msg;
            }
        }
        return ALL.msg;
    }
}

